package niuke;

import java.util.Scanner;

public class 最大的奇约数 {

    static long n;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
         n = scanner.nextLong();
        long result = 0;
        while (n>0){
            result = result + f();
        }
        System.out.println(result);
    }

    public static long f(){
        if(n%2 == 1){
            n = n/2;
            return (n+1)*(n+1);

        }
        else {
            n = n/2;
            return n*n;
        }
    }
}
